package org.dei.dataserver;

import java.util.Iterator;

import org.dei.perla.rockfall.RockfallManager;
import org.dei.perla.rockfall.gui.MainWindow;
import org.dei.perla.sys.device.fpc.dspic.DSPicFPC;

public class GuiDSPic {
	
	private static RockfallManager manager;

	public static void main(String args[]) {
		
		manager = new RockfallManager();
		
		// Inizializzo l'interfaccia grafica ed aggancio le varie FPC
		javax.swing.SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				MainWindow window = new MainWindow(manager);
				window.showGui();
				
				// Aggiungo tutti i DSPic da cui voglio ricevere i dati
				Iterator<DSPicFPC> iterator = manager.getDSPicIterator();
				int i = 0;
				while (iterator.hasNext()) {
					DSPicFPC picFPC = (DSPicFPC) iterator.next();
					window.addDevice("DSPic " + i++, picFPC.registerQuery(null));
				}
			}
		});
	}
}
